
#ifndef BASE_ANDROID_LOG_
#define BASE_ANDROID_LOG_

#include <android/log.h>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>

static int enable = 0;
static const std::string prefix = "--------> cpp message: ";
static const std::string suffix = " <-----------";

class Logger
{
private:
    static const char *buildMessage(const char *message)
    {
        std::string totalMsg = prefix + message + suffix;
        const char * constCharStr = totalMsg.c_str();
        return constCharStr;
    }

public:
    static void logInfo(const char *tag, const char *message)
    {
        if (enable)
        {
            __android_log_print(ANDROID_LOG_INFO, tag, "%s", buildMessage(message));
        }
    }

    static void logWarn(const char *tag, const char *message)
    {
        if (enable)
        {
            __android_log_print(ANDROID_LOG_WARN, tag, "%s", buildMessage(message));
        }
    }

    static void logError(const char *tag, const char *message)
    {
        if (enable)
        {
            __android_log_print(ANDROID_LOG_ERROR, tag, "%s", buildMessage(message));
        }
    }

    static void logFatal(const char *tag, const char *message)
    {
        if (enable)
        {
            __android_log_print(ANDROID_LOG_FATAL, tag, "%s", buildMessage(message));
        }
    }
};

#endif